home *** CD-ROM | disk | FTP | other *** search
- Path: winternet.com!not-for-mail
- From: jdege@winternet.com (Jeff Dege)
- Newsgroups: comp.lang.c++
- Subject: Re: Fastest Sorting Algorithm?
- Date: 6 Apr 1996 19:41:36 GMT
- Organization: StarNet Communications, Inc
- Message-ID: <4k6hdg$5ob@blackice.winternet.com>
- References: <Dou55w.7MB@novice.uwaterloo.ca> <DpAxtI.3w9@undergrad.math.uwaterloo.ca> <4k4unk$15qe@sol.caps.maine.edu> <4k680p$6fs@longwood.cs.ucf.edu>
- NNTP-Posting-Host: tundra.winternet.com
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- On 6 Apr 1996 12:01:13 -0500, Mark Schnitzius (schnitzi@longwood.cs.ucf.edu) wrote:
- :
- : Is it really 2logn? My understanding was that a sort couldn't be
- : less than nlogn... More info, please.
-
- No sort that works on comparing elements can be less than O(n*log(n)).
- There are sorts that don't work by comparing elements that can do better
- than this, but are restricted in the types of elements they can sort.
- You'll find these in the texts as radix or bucket sorts.
-
- The fastest sort of all uses a different trick altogether. It's
- the TrickSort:
-
- Input: an array A of n integers with arbitrary ordering.
- Result: an array A of n integers ordered such that A[i] <= A[i+1] for
- all i in [0, n-1).
-
- Solution:
-
- trickSort(int A[], int size)
- {
- int i;
-
- for (i=0; i<size; i++)
- A[0] = 0;
- }
-
- --
- "I quite agree with you," said the Duchess; "and the moral of
- that is -- `Be what you would seem to be' -- or, if you'd like it put
- more simply -- `Never imagine yourself not to be otherwise than what it
- might appear to others that what you were or might have been was not
- otherwise than what you had been would have appeared to them to be
- otherwise.'"
- -- Lewis Carrol, "Alice in Wonderland"
-
-
-